// pages/test/test.js
var QQMapWX = require('../../utils/qqmap-wx-jssdk.min.js')
var demo = new QQMapWX({
  key: 'OMYBZ-RE4HF-H6NJD-NM3DP-I7DQH-XHFLG' // 申请的key
})
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },
  onLoad:function(){
    console.log(app.globalData)
    //获取周围10家写字楼 即附近地址
    demo.search({
      location: {
        latitude: app.globalData.local.lati,
        longitude: app.globalData.local.longi
      },
      page_size: 10,
      keyword: '写字楼',
      success: function (res) {
        console.log(res)        
      },
      fail: function (res) {
        console.log(res);
      }
    })
  },
  fuzzySearch: function(e){
    demo.getSuggestion({
      region: app.globalData.city,
      keyword: e.detail.value,
      policy: 1,
      success: function (res) {
        console.log(res)
      },
      fail: function (res) {
        //在此隐藏搜索地址模块
        console.log(res);
      }
    })
  }
})